from django.db import models

#主页的 models 数据
from index.models import tb_team
#分页的母模板
from utils import forms

class Aq_works(forms.ModelBase):
    '''
    作品 应该有 作品名称 ， 作品图片

    '''
    title = models.CharField(max_length=20,null=True,blank=True,verbose_name="作品")
    image = models.URLField(default='',verbose_name='URL地址')
    t_team = models.ForeignKey(tb_team,on_delete=models.CASCADE)

    class Meta:
        db_table = 'aq_works'
        verbose_name = "作品名称"

    def __str__(self):
        return self.title
class Aq_banners(forms.ModelBase):
    '''
    banner 存放的图片
    '''
    title = models.CharField(max_length=100,verbose_name='banner名称',help_text='banner名称')
    image = models.URLField(verbose_name='图片地址',help_text='图片地址')
    t_team = models.ForeignKey(tb_team,on_delete=models.CASCADE)

    class Meta:
        db_table = 'aq_banner'
        verbose_name = 'banner 图片'


class Aq_er(forms.ModelBase):
    '''
        队伍人员
    '''
    name = models.CharField(max_length=20,verbose_name="标题",default='',null=True,blank=True)

    image = models.URLField(default='',verbose_name='图片地址')
    #与团队为一对多的关系
    a_team = models.ForeignKey(tb_team,on_delete=models.CASCADE)

    class Meta:
        db_table = 'aq_er'
        verbose_name ="队伍人员"

    def __str__(self):
        return self.name

class tb_class(forms.ModelBase):
    '''

    为动漫和SP 和其他的进行分类处理

    连接团体

    '''
    class_name = models.CharField(max_length=100,verbose_name='分类名称')
    class_image = models.URLField(default='',verbose_name='URL图片',null=True,blank=True)
    t_name = models.ForeignKey(tb_team,on_delete=models.CASCADE)

    class Meta:
        db_table = 'tb_class'
        verbose_name = '分类'

class Aq_anime(forms.ModelBase):
    '''
        储存动漫
    '''
    anime_name = models.CharField(max_length=10,default='',verbose_name='动漫名称',help_text='动漫名称')
    anime_image = models.URLField(null=True,verbose_name='动漫图片')
    anime_video = models.URLField(null=True,verbose_name='动漫路径')
    anime_code = models.BooleanField(default=True,verbose_name='动漫状态',help_text='动漫状态')

    c_anime = models.ForeignKey(tb_class,on_delete=models.CASCADE)
    t_team =models.ForeignKey(tb_team,on_delete=models.SET_NULL,null=True)
    class Meta:
        db_table = 'aq_anime'
        verbose_name = '动漫名称'

    def __str__(self):
        return self.anime_name

class Anime_Sp(forms.ModelBase):
    '''

    无法绑定 动画 和 人物

    与团体 有绑定关系

    '''
    anime_name = models.CharField(max_length=100,verbose_name='Sp的名称')
    sp_image = models.URLField(verbose_name='Sp图片')
    anime_video = models.URLField(verbose_name='Sp视频')

    c_team = models.ForeignKey(tb_class,on_delete=models.CASCADE)
    t_team =models.ForeignKey(tb_team,on_delete=models.SET_NULL,null=True)
    class Meta:
        db_table = "Anime_Sp"
        verbose_name = 'SP合集'
        verbose_name_plural = 'SP合集'


class Aq_activity(forms.ModelBase):
    ''''
       各种活动 进行储存
    '''
    power = {
        ('1','一级'),
        ( '2','二级'),

    }

    activity_title = models.CharField(max_length=150,verbose_name='活动名称',help_text='活动名称')
    activity_desc = models.TextField(verbose_name='活动介绍',help_text='活动介绍')
    activity_img = models.URLField(null=True,verbose_name='活动图片',help_text='活动图片')
    priority = models.IntegerField(default=1,choices=power,verbose_name='活动权限',help_text='活动权限')


    c_team = models.ForeignKey(tb_class,on_delete=models.CharField)
    t_team =models.ForeignKey(tb_team,on_delete=models.SET_NULL,null=True)

    class Meta:
        db_table = 'aq_activity'
        verbose_name = '活动'
        verbose_name_plural = '活动'

    def __str__(self):
        return self.activity_title

class Tag(forms.ModelBase):
    '''

    循环壁纸

    '''
    name = models.CharField(max_length=100,verbose_name='壁纸名称',help_text='壁纸名称',default='',null=True,blank=True)
    image = models.URLField(verbose_name='图片地址',help_text='图片地址',default='',null=True,blank=True)

    t_team = models.ForeignKey(tb_team,on_delete=models.SET_NULL,null=True)

    class Meta:
        db_table = 't_tag'
        verbose_name = '壁纸图片'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name




# class News_Hot(forms.ModelBase):
#     '''
#
#     放置最新文章的名称
#
#     应对照用户表
#
#     '''
#
#     news_title = models.CharField(max_length=400,verbose_name='文章名称',help_text='文章名称')
#     news_image = models.URLField(default='')
#     news_content = models.TextField(verbose_name='文章内容',help_text='文章内容')
#
#     class Meta:
#         db_table = "tb_news_host"
#         verbose_name = '文章'
#
#     def __str__(self):
#         return self.news_title